title.js ➔ setTitle   A
last analyzed

Complexity

Conditions 4

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 4
1
define(function () {
2
  'use strict';
3
4
  return function () {
5
    function setTitle(d) {
6
      var title = [config.siteName];
7
8
      if (d !== undefined) {
9
        title.unshift(d);
10
      }
11
12
      document.title = title.join(' - ');
13
    }
14
15
    this.resetView = function resetView() {
16
      setTitle();
17
    };
18
19
    this.gotoNode = function gotoNode(d) {
20
      setTitle(d.hostname);
21
    };
22
23
    this.gotoLink = function gotoLink(d) {
24
      setTitle(d[0].source.hostname + ' \u21D4 ' + d[0].target.hostname);
25
    };
26
27
    this.gotoLocation = function gotoLocation() {
28
      // ignore
29
    };
30
31
    this.destroy = function destroy() {
32
    };
33
34
    return this;
35
  };
36
});
37